require('dotenv').config()
const db = require('./config/database')

async function testDb () {
  try {
    console.log('测试数据库连接...')
    await db.testConnection()

    console.log('查询小说数据...')
    const novels = await db.query('SELECT * FROM novels LIMIT 1')
    console.log('小说数据:', novels)

    console.log('查询用户数据...')
    const users = await db.query('SELECT COUNT(*) as count FROM users')
    console.log('用户数量:', users)
  } catch (error) {
    console.error('测试失败:', error)
  }
}

testDb()
